home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: balu@netcom.com (Balasubramanian)
- Newsgroups: comp.std.c++
- Subject: pointer conversions from the null pointer constant
- Date: 20 Feb 1996 10:51:57 PST
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <baluDn1pGL.8J1@netcom.com>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Mon, 19 Feb 1996 23:05:09 GMT
- Apparently-To: comp-std-c++@uunet.uu.net
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMSoYZky4NqrwXLNJAQEONwIAmT5ulblslboLdXf41GdA1i9Ho4md6vQn
- lEDGouHNaoORBf5piJNzksMdgQv2+3mtbmHNE4acx+Pci6A+62X2CQ==
- =U4lq
- Originator: austern@isolde.mti.sgi.com
-
- Given the following:
-
- class A {};
- class B : public A {};
- class C : public B {};
-
- void foo(A*) { ... }
-
- void foo(C*) { ... }
-
- int main() {foo(0); return 0;}
-
- How is the call to foo() in main() to be resolved? It seemed obvious
- to me that the call should be ambiguous but some compilers resolve
- it as a call to foo(C*) (while others reject it as ambiguous.)
-
- Is the conversion of the null pointer constant to C*
- better than its conversion to A*? I couldn't find anything
- in the ARM or the draft standard (May 1995) to support this
- interpretation.
-
- Thanks.
-
-
- - balu
- ---
- [ To submit articles: Try just posting with your newsreader. If that fails,
- use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std.c++-request@ncar.ucar.edu
- ]
-